import { call, put } from 'redux-saga/effects'
import { getUserInfo, getDic } from '@/api'

export function* fetchUserInfo() {
  try {
    const { data } = yield call(getUserInfo)
    yield put({ type: 'G/setupUserInfo', payload: data })
  } catch (error) {
    yield put({ type: 'REQUEST_FAILED', error })
  }
}

export function* fetchDic() {
  try {
    const { data } = yield call(getDic)
    yield put({ type: 'G/setupDic', payload: data })
  } catch (error) {
    yield put({ type: 'REQUEST_FAILED', error })
  }
}
